package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.FaultCustForm;
import com.ruoyi.system.domain.WorkForm;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.IWorkCustomerService;
import com.ruoyi.system.service.IWorkFormService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/system/transToCheck")
public class transToCheckController extends BaseController {
    private String prefix = "system/check";

    @Autowired
    private IWorkCustomerService workCustomerService;

    @Autowired
    private IWorkFormService workFormService;

    //@RequiresPermissions("system:transToCheck:view")
    @GetMapping()
    public String customer()
    {
        return prefix + "/transTocheck";
    }

    /**
     * 查询用户列表
     */
   // @RequiresPermissions("system:pend:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WorkForm workForm)
    {
        startPage();
        String loginName = "admin";
        List<FaultCustForm> list =workFormService.selectWorkTransToCheck(workForm,loginName);
        return getDataTable(list);
    }
    /*
        转移审核失败
         */
    @PostMapping("/transCheckOff/{id}")
    @ResponseBody
    public AjaxResult transCheckOff(@PathVariable("id") Long id)
    {
        Long returnId = 2L;
        return toAjax(workFormService.updateWorkFormBycheckOk(id,returnId));
    }
    /*
        转移审核成功
         */
    @PostMapping("/transCheckOk/{id}")
    @ResponseBody
    public AjaxResult transCheckOk(@PathVariable("id") Long id)
    {
        Long returnId = 1L;
        int rows = workFormService.updateWorkFormBycheckff(id, returnId);
        return toAjax(rows);

    }
}
